package com.top.art.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * The enum Distribute type enum.
 *
 * @author hjh
 * @version 2020 /10/6-12:43
 */
@Getter
public enum DistributeTypeEnum {

    /**
     * Examination distribute type enum.
     */
    EXAMINATION("examination", "按考场分配"),
    /**
     * Paper distribute type enum.
     */
    PAPER("paper", "按试卷分配"),
    ;

    /**
     * code
     */
    private String code;

    /**
     * name
     */
    private String name;


    DistributeTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * Gets distribute type enum.
     *
     * @param code the code
     * @return the distribute type enum
     */
    public static DistributeTypeEnum getDistributeTypeEnum(String code) {
        for (DistributeTypeEnum item : values()) {
            if (StringUtils.equals(item.code, code.trim())) {
                return item;
            }
        }
        return null;
    }
}
